<!-- 我的收藏页面 -->
<template>
  <view
    class="container"
   
  >
    <!-- 空白页 start-->
    <view
      v-if="collectList && collectList.length == 0"
      class="flex_column_start_center empty_part">
      <image class="img" :src="imgUrl + 'empty_collect.png'" />
      <text class="tip_con">{{ $L('暂无收藏') }}~</text>
    </view>
    <!-- 空白页 end-->
	
	<view class="favorite">
		<view v-for="(item, index) in collectList" :key="index" class="f_item" :style="'margin-right:' + (index % 3 == 2 ? '0rpx' : '3rpx')"
		         @tap="goVideoPlay(item)">
		    <image class="f_img" :src="item.videoImage" mode="aspectFill"></image>
			 <view class="bottom">
			   <view class="left">
				 <image :src="favIcon"></image>
				 <text>{{ item.likeNum }}</text>
			   </view>
			 </view>
			 <view class="article" v-if="item.videoType == 2">
			   <image :src="articleIcon"></image>
			 </view>
		 </view>
	</view>

	
   <loadingState
      v-if="loadingState == 'first_loading' || collectList.length > 0"
      :state="loadingState"
    />
    <!-- 收藏的商品 end-->

  </view>
</template>

<script>
import recommendGoods from '@/components/recommend-goods.vue'
import goodsCollectItemH from '@/components/goods_collect_item_h.vue'
import loadingState from '@/components/loading-state.vue'
import { mapState } from 'vuex'
export default {
  components: {
    recommendGoods,
    goodsCollectItemH,
    loadingState
  },
  data() {
    return {
      imgUrl: getApp().globalData.imgUrl,
      collectList: [], //收藏列表
      hasMore: true, //是否还有数据
      pageSize: 10,
      current: 1,
      loadingState: 'first_loading',
      followId: '',
	  favIcon: getApp().globalData.imgUrl + 'svideo/fav_w.png',
     
    }
  },
  onLoad(option) {
	 
    setTimeout(()=>{
      uni.setNavigationBarTitle({
        title: this.$L('我的收藏')
      })   
    },0);
  },
  onShow() {
    this.getList()
  },
  onHide() {
    this.followId = -1
  },
  computed: {
    ...mapState(['userInfo'])
  },
  
  onReachBottom() {
      this.getList()
  },
  methods: {
    getList() {
      let params = {}
      params.url = 'v3/video/front/video/author/likeList'
      params.method = 'GET'
      params.data = {}
      params.data.pageSize = this.pageSize
      params.data.current = this.current
      this.loadingState =
        this.loadingState == 'first_loading' ? this.loadingState : 'loading'
      this.$request(params).then((res) => {
        if (res.state == 200) {
          if (this.current == 1) {
            this.collectList = res.data.list
          } else {
            this.collectList = this.collectList.concat(res.data.list)
          }
           console.log('collectList',this.collectList);
           console.log('1collectList',this.collectList.length);
          this.hasMore = this.$checkPaginationHasMore(res.data.pagination) //是否还有数据
          if (this.hasMore) {
            this.current++
            this.loadingState = 'allow_loading_more'
          } else {
            this.loadingState = 'no_more_data'
          }
        } else {
          this.$api.msg(res.msg)
          this.loadingState = 'no_more_data'
        }
      })
    },
   
    //页面触底事件
    

   
   
  }
}
</script>

<style lang="scss">
page {
  width: 750rpx;
  margin: 0 auto;
  background-color: #f5f5f5;
}

.favorite {
  position: relative;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
}

 .favorite .f_item {
  width: calc((100% - 6rpx) / 3);
  height: 323rpx;
  overflow: hidden;
  position: relative;
  margin-bottom: 3rpx;
  margin-right: 3rpx;
}

 .favorite .f_item .f_img {
  width: 100%;
  height: 100%;
}

.f_item /deep/ img {
  display: none;
}

 .favorite .f_item .bottom {
  position: absolute;
  bottom: 0;
  left: 0rpx;
  right: 0rpx;
  height: 92rpx;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 2;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
  padding: 0 10rpx 5rpx 5rpx;
}

.favorite .f_item .bottom .left,
 .favorite .f_item .bottom .right {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}

 .favorite .f_item .bottom .right {
  justify-content: flex-end;
}

 .favorite .f_item .bottom .left image,
 .favorite .f_item .bottom .right image {
  width: 42rpx;
  height: 42rpx;
}

.favorite .f_item .bottom .left text,
.favorite .f_item .bottom .right text {
  color: #fff;
  font-size: 24rpx;
  margin-left: 3rpx;
}



.container {
  background: $bg-color-split;
}

.container_FF {
  background: #ffffff;
}

.empty_part {
  display: flex;
  flex: 1;
  width: 100%;
  height: 586rpx;
  background: #fff;
  border-top: 20rpx solid $bg-color-split;

  .img {
    width: 380rpx;
    height: 280rpx;
    margin-bottom: 37rpx;
    margin-top: 88rpx;
  }

  .tip_con {
    color: $main-third-color;
    font-size: 26rpx;
  }

  .ope_btn {
    color: var(--color_main);
    font-size: 28rpx;
    padding: 0 25rpx;
    height: 54rpx;
    background:var(--color_halo);
    border-radius: 27rpx;
    margin-top: 20rpx;
  }
}

.empty_part_FF {
  height: auto;
  padding-top: 200rpx;
}

.goods_list {
  border-top: 20rpx solid $bg-color-split;
  width: 750rpx;
  overflow-x: hidden;
}

/* 分享弹框 start */
.share_model {
  width: 750rpx;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
}

.share_model_list {
  display: flex;
  justify-content: space-around;
  padding: 0 50rpx;
  box-sizing: border-box;
  position: fixed;
  bottom: 150rpx;
  z-index: 110;
  width: 750rpx;

  .share_model_pre {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border-radius: 0;
    height: auto;
    line-height: auto;

    &::after {
      border-width: 0;
    }

    image {
      width: 105rpx;
      height: 105rpx;
    }

    text {
      font-size: 24rpx;
      font-family: PingFang SC;
      font-weight: 500;
      color: #ffffff;
      line-height: 36rpx;
      margin-top: 30rpx;
    }
  }
}

.share_model_close {
  width: 46rpx;
  height: 46rpx;
  bottom: 60rpx;
  position: fixed;
  z-index: 110;
  left: 0;
  right: 0;
  margin: 0 auto;

  image {
    width: 46rpx;
    height: 46rpx;
  }
}

button {
  padding: 0;
  margin: 0;
}

/* 分享弹框 end */
</style>
